<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>短链接 - 免费的短链接生成网站</title>
        <meta name="renderer" content="webkit" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
        <!--<link rel="stylesheet" href="/static/layui/css/layui.css"  media="all" />-->
        <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->          
        <!--<script src="/static/layui/layui.js"></script>-->
        <script src="/static/jquery.min.js"></script>
    </head>
    <body>
        <div id="content" style="font-size: 14px;">正在跳转 </div>
    </body>
</html>
<script>
var pathname = location.pathname.substring(1);
var content = $("#content");
var url = "http://127.0.0.1:8091/v1/url/" + pathname;
var gourl = function(uri) { 
    var counter = 0;
    var timer = setInterval(function() { 
        if (counter > 30) { 
            clearInterval(timer);
            top.location.href = uri;
        }
        content.html(content.html() + ". ");
        counter += 1;
    }, 100);
};
$.get(url, function(res) { 
    if (res.code !== 0) { 
        content.html(res.message);
        return;
    }
    //location.href = res.result.url;
    gourl(res.result.url);
});
</script>
